package ExceptionTest;

import java.util.Scanner;

public class PersonIllageDemo {
    public static void main(String[] args) {
        Person person = new Person();
        Scanner sc = new Scanner(System.in);
        int age;

        System.out.println("请录入用户的年龄:");
        age = sc.nextInt();
        try {

            person.setAge(age);
        } catch (IllageAgeException e) {
//            e.printStackTrace();
            System.out.println(e.getMessage());
        }
        System.out.println("用户年龄"+person.getAge());
    }
}
